package com.newford.test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class ConnectAccess {

	public static void main(String[] args) {
		try {
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			//jdbc:odbc:数据源名,账号，密码
			Connection conn = DriverManager.getConnection("jdbc:odbc:rzy");// 创建连接对象
			Statement stmt1=conn.createStatement();//创建数据处理对象   
//			String sql = "create table person(id char(32),name varchar(20))";
			String sql = "create table t_news("+
							"newsid char(32) primary key,"+
							"title varchar(200) not null,"+
							"content varchar(4000),"+
							"userid char(32),"+
							"commitdate date,"+
							"updatedate date,"+
							"href varchar(256),"+
							"delflag char(2),"+
							"readtime int"+
							");";
			int i=stmt1.executeUpdate(sql);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}// 建立侨联
		catch (SQLException e) {
			e.printStackTrace();
		}
	}

}
